package br.com.clinica.supercao.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import br.com.rpteixeira.entity.AbstractEntity;
@Entity
@Table(name="CONSULTAS",schema="clinica")
public class Consulta extends AbstractEntity {
	private static final long serialVersionUID = 1L;
	
	private Veterinario veterinario;
	private Animal animal;
	private Date dataConsulta;
	private Double valorConsulta;
	private String horaConsulta;
	
	@Override
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CONSULTA_GENERATOR")
	@SequenceGenerator(name = "CONSULTA_GENERATOR", sequenceName = "consulta_seq", initialValue = 1, allocationSize = 1)
	@Column(name="SEQ_CONSULTA")
	public Integer getId() {
		return this.id;
	}
	@ManyToOne()
	@JoinColumn(name="SEQ_VETERINARIO_CONSULTA",referencedColumnName="SEQ_VETERINARIO")
	public Veterinario getVeterinario() {
		return veterinario;
	}

	public void setVeterinario(Veterinario veterinario) {
		this.veterinario = veterinario;
	}
	@ManyToOne(cascade=CascadeType.REFRESH)
	@JoinColumn(name="SEQ_ANIMAL_CONSULTA",referencedColumnName="SEQ_ANIMAL")
	public Animal getAnimal() {
		return animal;
	}

	public void setAnimal(Animal animal) {
		this.animal = animal;
	}
	@Temporal(TemporalType.DATE)
	@Column(name="DATA_CONSULTA")
	public Date getDataConsulta() {
		return dataConsulta;
	}

	public void setDataConsulta(Date dataConsulta) {
		this.dataConsulta = dataConsulta;
	}
	@Column(name="VALOR_CONSULTA")
	public Double getValorConsulta() {
		return valorConsulta;
	}

	public void setValorConsulta(Double valorConsulta) {
		this.valorConsulta = valorConsulta;
	}
	@Column(name="HORA_CONSULTA",length=50)
	public String getHoraConsulta() {
		return horaConsulta;
	}
	public void setHoraConsulta(String horaConsulta) {
		this.horaConsulta = horaConsulta;
	}
	
	
}
